package com.gaogao.java;

public class ArrayTest {
    public static void main(String args[]){
        String[] delete={"aa","bb","cc","dd","ee"};

//        arrayCopy(delete,3);
//        for (String a:delete) {
//            System.out.print(a+" ");
//        }
        String[] add=new String[delete.length*2];
        System.arraycopy(delete,0,add,0,delete.length);
      //  System.arraycopy(add,2,add,2+1,add.length-3);
        add(add,2,"ff");
        for (String a:add) {
            System.out.print(a+" ");
        }
//        String[] copy=new String[5];
//        System.arraycopy(delete,3,copy,3-1,delete.length-3);
//        for (String a:copy) {
//            System.out.print(a+" ");
//        }
    }
    public static void arrayCopy(String[] src,int lengch){
        System.arraycopy(src,lengch,src,lengch-1,src.length-lengch);

        src[src.length-1]=null;
    }
    public static void add(String src[],int length,String name){
        System.arraycopy(src,length,src,length+1,src.length-length-1);
        src[length]=name;
    }
}
